SK server on Windows / Mac

There are many different servers which can provide Signal K data. The first sections of this document explain the installation of Signal K server node for node.js, an implementation of Signal K server available on multiple platforms.


Table of contents:

Installation Signal K node server for node.js on Windows

Installation Signal K server node for node.js on Mac (contributions welcome)


Installation Signal K server node Windows with an installer

This is the recommended way of getting a Signal K node server on you Windows machine. Please move forward to this Signal K node server sub-project for Windows installer with web-based installation if you are not already a Node.js user. You will enjoy the easy installation and the possibility to run SignalK node server as Windows service.


Installation Signal K node server for node.js on Windows

It may occur that you are already a user of node.js. While it is perfectly possible to run both the above Windows SignalK node server installer's node.js with your own node.js installation (it is installed locally, in the local scope of its own, dedicated directory out of the user context), you may want to use the latest node.js nevertheless, or just try things out. The below explanation is for you.

Native node.js on Windows 10

npm is needed. You get easiest with node.js in which it is bundled and for which the Signal K node server is packaged for and made available in nmp-repositories, Get the software from https://nodejs.org/en/download/. Download the LTS (long term support) version.

When the installation is finished, refer from the command prompt that you have, at minimum the following versions:

node -v
v12.13.0
npm -v
6.5.0

We will use npm and its remote repository to install SK node server:

npm install -g --unsafe-perm signalk-server

To run it, type:

signalk-server
Settings file does not exist, using empty settings
signalk-server running at 0.0.0.0:3000

You would point your browser to http://localhost:3000 to get connected to the Signal K node server's user interface. Having this pages indicates that this installation phase ha been successfully completed. You fill find from the main page of this wiki section for Signal K a page which gives you information how to configure the server for the usage with OpenCPN.

Some screenshots and a walkthrough is available in this Signal K server node discussion thread. The main source of annoyances seems to be that one does not use a clean cut installation of a Node.js LTS (long term support version) and to have traces of the different Node.js versions (no, you do not need version 10).

Startup batch file script

Start Signal K node server on Windows with a click.

echo off
chcp 1252
rem Ensure this Node.js and npm are first in the PATH
set "PATH=%APPDATA%\npm;%~dp0;%PATH%"
setlocal enabledelayedexpansion
pushd "%~dp0"
rem Check out the Node.js version.
set print_version=node.exe -p -e "process.versions.node + ' (' + process.arch + ')'"
for /F "usebackq delims=" %%v in (`%print_version%`) do set version=%%v
rem Print message.
if exist "C:\Program Files\nodejs\npm.cmd" (
  echo Your environment has been set up for using Node.js !version! and npm.
) else (
  echo Your environment has been set up for using Node.js !version! but there is NO npm.
)
popd
endlocal
start signalk-server
rem just a short dummy delay to give up the CPU
waitfor /t 5 dummyskstart
start http://localhost:3000
exit
Automatic start on login

If you want a complete automatic startup after your login, create a file with above contents as skstart.bat in your account's start-up folder C:\Users\YOURNAME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup. However, since this is not a Windows service and the automatic restart of the Signal K node server does not work with this, it is recommended to have this script, or at least a copy of this script on your Desktop for easy access since for many settings changes the Signal K node server requires a restart.

Automatic restart using periodic tasks

Another possibility for the starting the node.js and SignalK node server completely automatically and in a repeatable manner using the above script is to make a periodic task using Windows PowerShell. If the above script is on your desktop named skstart.bat, you can say in PowerShell:

If (!(Get-Process -Name node -ErrorAction SilentlyContinue))
{Invoke-Item C:\Users\YOURNAME\Desktop\skstart.bat
}

Here we suppose that the only application under node.js being SignalK, call the above script if the node.exe is not running. You would save the above code as a script and create a periodic task to execute it (see here how): if the node.exe is not running (SignalK being the only task it executes), SignalK will be started again.

Caveat #1

You probably notice errors, for canboat and socketcan during the installation, so some CAN-bus connected dongles or such will not work in this architecture if you have errors like this:

wanted {"os":"linux","arch":"any"} (current: {"os":"win32","arch":"x64"}
Caveat #2

.signalk directory in your home directory:

Caveat #3

Restart of the server from the admin GUI interface of the browser does not work, of course, since you have launched the server manually. If you click that button on the browser user interface, the signalk-server process will sto - you need to start the server again from the command line. Use the up-arrow key and press enter.


Signal K server node for node.js as Docker-image

Install https://www.docker.com/products/docker-desktop the runtime environment for so called application containers, containing everything the application needs for running, but nothing more in encapsulated format. To fetch and run Signal K server for the first time type the following from the command line:

docker run --name signalk-server --restart=unless-stopped -p  3000:3000 signalk/signalk-server

'3000' is the port number which you will use again to connect with the administration interface to set it up. You would point your browser to http://localhost:3000 to get connected to the Signal K node server's user interface. Having this pages indicates that this installation phase ha been successfully completed. You fill find from the main page of this wiki section for Signal K a page which gives you information how to configure the server for the usage with OpenCPN.

If you allow the Docker to start automatically with your system, this service will start automatically as well.

Alternatively, you may want to mount the node's home directory on you local disk: In Docker world, containers do come and go, for example upgrade is best done by deleting a container and then reinstalling it. But you would lose your settings. The solution is to provide a volume from the local disk to the Node's home directory:

  1. In Docker Desktop, Settings, Shared Drives, allow your disk drive to be seen by the containers
  2. Delete the container created above (you may want to use a graphical tool for that if you do hesitate with the docker command line, see below, Caveat #6 for a suitable tool suggestion. We are going to refer to that later on.
  3. Start a new container, this time with the following command lines
docker volume create signalk-storage
docker run --name signalk-server --restart=unless-stopped -p 3000:3000 -v signalk-storage:/home/node/.signalk signalk/signalk-server
  1. The above operation is called mounting a volume. But you can also bind a Windows folder and give that the Signal K, so that you can easily edit its contents. Create an appropriate folder, such as signalkdocker in your home directory
  2. The following can be done with docker command line bind command, but since we have a graphical user interface to help us, let's use that to mount that folder as a placeholder for the Docker image's Signal K node server's home directory, on the exported, virtual Docker-volume we created on you local disk for it:
    live.staticflickr.com_65535_49129840771_450c25ee23_z.jpg
  3. Almost immediately, the new home folder in your local disk start to be filling with the Signal K node server's settings and other files you want to keep from one container to another:
    live.staticflickr.com_65535_49130024682_756df60499_m.jpg

With this configuration you can exploit and test all the functionalites of a Signal K node server with a simple and fast container installation/reinstallation.

When it comes to get data in and data out, you need more network ports, some perhaps with UDP-protocl. Please consult this Marine PI provisioning template to get an idea of all ports which can be concerned. If we take the usual, OpenCPN port number 10110, you would need to start the Signal K container with the following command, instead of just the port 3000:3000 mapping, you would give the extra ports (please remember that the usual practice is to remove the old container before, then map the home directory from your local disk where it is safe to this new instance, using the graphical user interface tool):

docker run --name signalk-server --restart=unless-stopped -p 3000:3000 -p 10110:10110 -v signalk-storage:/home/node/.signalk signalk/signalk-server
Caveat #4:

This is, for the time being only to try things out - if all communication is TCP or UDP, you would not notice any difference to a native operation other than it would be more difficult to set up the connection between different elemens due to large number of network ports Signal K node server is using.

Caveat #5:

It is not always easy to understand how to get files in and out in a specific Docker application. In the above how-to we give one example for Signal K node server on Docker so that its home directory can be exported. But there are other items you might be interested to see and keep for one installation to another, like log files, etc. You may want to repeat the above steps for the home directory with an other folder you are interested in.

Caveat #6:

Docker service management from the command line can be challenging. For your convenience, you can install https://kitematic.com which has a very simple GUI to manage your Docker images. It also proposes you a catalog of other application images which you can browse and install for your convenience.


Ubuntu node.js on Windows Subsystem for Linux

courtesy of conachair
cf. http://www.cruisersforum.com/forums/f134/plugin-dashboard-44087-37.html#post301097

On my system I have WSL2 running, windows system for linux.
Quite a lot of info here > https://docs.microsoft.com/en-us/win...l/wsl2-install (left colon, install on windows10)
Then installed Ubuntu from the windows app store.

Then in the ubuntu terminal followed to install instructions for signalk raspberry Pi from here - https://github.com/SignalK/signalk-s...nstallation.md
and running 'signalk-server –sample-nmea0183-data' got it up and running, available back in windows chrome with the address Quote: |http://localhost:3000/|



Installation Signal K server node for node.js on Mac

Contribution from a Mac owner needed : the installation is the same as the native node.js installation for Windows explained above, to be confirmed if any issues.